<%--
  Created by IntelliJ IDEA.
  User: bi
  Date: 2019/1/2
  Time: 16:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>登录页</title>
  <link type="text/css" rel="stylesheet" href="/css/style.css" />
</head>
<script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
    function check() {
        var flag = false;
        $("#name").focus(function () {

            if ($(this).val() == this.defaultValue) {
                $(this).val("");
                $(this).removeClass("input-texts");
                $(this).addClass("news");
                $(".buttons #error").text("");
            }
        }).blur(function () {
            if ($.trim($(this).val()) == "") {
                $(this).removeClass("news");
                $(this).addClass("input-texts");
                $(this).val(this.defaultValue);
            }
            var name = /^\w{3,9}$/;
            var psd = /^[0-9a-zA-Z]{6,10}$/;
            if (name.test($("#name").val()) == false || psd.test($("#pwd").val()) == false) {
                $(".buttons #error").text("用户名或密码错误,请重新输入！");
                return false;
            } else {
                $(".buttons #error").text("");
            }
            flag = true;
            return true;

        });

        $(".myreset").click(function () {
            window.location = ".jsp";
        });
    }
</script>

<body class="blue-style">
<div id="login">
  <div class="icon"></div>
  <div class="login-box"><!--admin_index-->
    <form method="post"  action="/UserServlet?action=login" onsubmit="return check()">
      <dl>
        <dt>用户名：</dt>
        <dd><input type="text" id="name" name="userName" class="input-texts" value="请输入您的用户名"  /></dd>
        <dt>密　码：</dt>
        <dd><input type="password" id="pwd" name="passWord" class="input-texts" /></dd>
      </dl>
      <div class="buttons">
        <div id="error" style="color:red;">${msg }</div>
        <div id="input">
          <input type="submit" name="submit" value="登录系统" class="input-button" />
          <input id="myreset" type="reset" name="resetbutton" value="重　　填" class="input-button" />
        </div>
      </div>
    </form>
  </div>
</div>
</body>
</html>
